﻿<%@ Page Title="Анализ :: Целевой ассортимент" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="TargetSCU.aspx.cs" Inherits="Analysis.TargetSCU" %>
<%@ Register TagName="CustomColumnDialog" Src="~/Controls/CustomColumnDialog.ascx" TagPrefix="analysis"  %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript">
        var autoCity = "";
        var autoRegion = "";

        $(function () {
            
            Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(function (evt, args) {
                $('.mightOverflow').bind('mouseenter', function () {
                    var $this = $(this);

                    if (this.offsetWidth < this.scrollWidth && !$this.attr('title')) {
                        $this.attr('title', $this.attr('data-overflow-title'));
                    }
                });
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="page_header">
        <h2><img src="<%=ResolveClientUrl("~") %>images/design/contract_tt_icon.png" alt="" title="" /> Целевой ассортимент</h2>
    </div>
            
			<asp:UpdatePanel ID="upMain" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
        	<div class="page_container">
                <div class="search_panel">
                <div class="row">
                	<div class="col-lg-3">
                    	<div class="form-group">
                            <label class="control-label">Год</label>
                    	    <asp:DropDownList CssClass="form-control" ID="ddlYearIdFilter" 
                                runat="server" DataValueField="YearId" DataTextField="YearId" 
                                AutoPostBack="true" onselectedindexchanged="ddlYearIdFilter_SelectedIndexChanged" />
                        </div>
                    </div>
                    <div class="col-lg-3">
                    	<div class="form-group">
                            <label class="control-label">Месяц</label>
                    	    <asp:DropDownList CssClass="form-control" ID="ddlMonthIdFilter" 
                                runat="server" DataValueField="MonthId" DataTextField="MonthName"
                                AutoPostBack="true" onselectedindexchanged="ddlMonthIdFilter_SelectedIndexChanged"/>
                        </div>
                    </div>
                    <div class="col-lg-6">                    	
                    </div>
                    
                </div>
                </div>
                
                <div class="table-responsive" style="overflow-x:auto;width:100%;">
                <asp:GridView ID="grid" AutoGenerateColumns="false" runat="server" CssClass="grid-table table table-bordered table-hover" DataKeyNames="RowId"
                AllowSorting="true" OnSorting="grid_Sorting" 
                AllowPaging="True" PageSize="20" OnPageIndexChanging="grid_PageIndexChanging"
                OnRowDataBound="grid_RowDataBound" OnRowCommand="grid_RowCommand"
                OnRowCreated="grid_RowCreated" OnPreRender="grid_PreRender">
                <PagerSettings Mode="NumericFirstLast" Position="TopAndBottom" PageButtonCount="4" NextPageText=">" PreviousPageText="<"  FirstPageText="первая" LastPageText="последняя"/>
                <Columns>
                    <asp:TemplateField HeaderText=""> 
                        <HeaderTemplate><asp:CheckBox runat="server" ID="chbSelectAll" AutoPostBack="true" OnCheckedChanged="SelectAll_CheckedChange" /></HeaderTemplate>
                        <ItemTemplate> 
                            <asp:CheckBox runat="server" ID="chbIsSelected" Checked='<%# Bind("IsSelected") %>' AutoPostBack="true" OnCheckedChanged="selected_CheckedChangeOver" />
                            <asp:HiddenField ID="hidTargetSCUId" Value='<%#Eval("TargetSCUId")%>' runat="server" />
                            <asp:HiddenField ID="hidSCUId" Value='<%#Eval("SCUId")%>' runat="server" />
                            <asp:HiddenField ID="hidSaleChannelId" Value='<%#Eval("SaleChannelId")%>' runat="server" />
                            <asp:HiddenField ID="hidStorePointId" Value='<%#Eval("StorePointId")%>' runat="server" />
                       </ItemTemplate>
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Наименование SKU"> 
                        <HeaderTemplate><asp:Label runat="server" ID="lblSCUNameField" Text="SCUName" Visible="false"/></HeaderTemplate> 
                        <ItemTemplate> 
                            <asp:Label ID="txtSCUName" runat="server" Text='<%# Bind("SCUName") %>' CssClass=""/>
                        </ItemTemplate> 
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Группа SKU">
                        <HeaderTemplate><asp:Label runat="server" ID="lblSCUGroupField" Text="SCUGroup" Visible="false"/></HeaderTemplate> 
                        <ItemTemplate> 
                            <asp:Label ID="txtSCUGroup" runat="server" Text='<%# Bind("SCUGroup") %>' CssClass=""/>
                        </ItemTemplate> 
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Подгруппа SKU"> 
                        <HeaderTemplate><asp:Label runat="server" ID="lblSCUSubGroupField" Text="SCUSubGroup" Visible="false"/></HeaderTemplate> 
                        <ItemTemplate> 
                            <asp:Label ID="txtSCUSubGroup" runat="server" Text='<%# Bind("SCUSubGroup") %>' CssClass=""/>
                        </ItemTemplate> 
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Формат ТТ"> 
                        <HeaderTemplate><asp:Label runat="server" ID="lblStorePointNameField" Text="StorePointName" Visible="false"/></HeaderTemplate> 
                        <ItemTemplate> 
                            <asp:Label ID="txtStorePointName" runat="server" Text='<%# Bind("StorePointName") %>' CssClass=""/>
                        </ItemTemplate> 
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Канал ТТ"> 
                        <HeaderTemplate><asp:Label runat="server" ID="lblSaleChannelNameField" Text="SaleChannelName" Visible="false"/></HeaderTemplate> 
                        <ItemTemplate> 
                            <asp:Label ID="txtSaleChannelName" runat="server" Text='<%# Bind("SaleChannelName") %>' CssClass=""/>
                        </ItemTemplate> 
                    </asp:TemplateField>

                    <asp:TemplateField HeaderText="Группировка"> 
                        <HeaderTemplate><asp:Label runat="server" ID="lblGroupingNameField" Text="GroupingName" Visible="false"/></HeaderTemplate> 
                        <ItemTemplate> 
                            <asp:TextBox ID="txtGroupingName" runat="server" Text='<%# Bind("GroupingName") %>' CssClass="form-control" placeholder="Введите группировку" ValidationGroup="updateItem"></asp:TextBox> 
                        </ItemTemplate> 
                    </asp:TemplateField>
                    
                </Columns>
                </asp:GridView>
                </div>
                <asp:Button CssClass="btn apps_btn apps_gray_btn" ID="btnSaveTargetSCU" Text="Сохранить изменения" runat="server" ValidationGroup="updateItem" onclick="btnSaveTargetSCU_Click" />
                <asp:Button CssClass="btn apps_btn apps_gray_btn" ID="btnExcelExport" Text="Экспорт в Excel" runat="server" OnClick="btnExcelExport_Click" />
                <asp:Button CssClass="btn apps_btn apps_gray_btn" ID="btnCustomColumn" Text="Конструктор адресной программы" runat="server" OnClientClick="showCustomColumn(); return false;" Visible="False" />
            </div>
            
            </ContentTemplate>
            <Triggers>
                <asp:PostBackTrigger ControlID="btnExcelExport" />
            </Triggers>
            </asp:UpdatePanel>
            
            <analysis:CustomColumnDialog ID="ctrlCustomColumnDialog"  runat="server"  AllowAdd="false" AllowVisible="true"/>
</asp:Content>
